﻿using System;
using System.ComponentModel;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text.RegularExpressions;
using Com.CodePlex.SPC3.SPbAM.Properties;

namespace Com.CodePlex.SPC3.SPbAM.Model {

	public class Server {

		public Server() {
			ActionResults = new List<ActionResult>();
			Config = new Dictionary<string, string>();
			WorkingDirectory = @"c:\psinstall\spbam\"; //todo: set per server
		}

		public string Name { get; set; }

		public string IP { get; set; }

		public Dictionary<string, string> Config { get; set; }

		public string WorkingDirectory { get; set; }

		public string Filename {
			get { return System.IO.Path.Combine(System.IO.Path.Combine(Environment.CurrentDirectory, Properties.Settings.Default.ServersDirectory), Name + ".xml");}
		}

		public IList<ActionResult> ActionResults { get; set; }

		public void AddActionResult(IList<string> results, string action) {
			ActionResults.Add(new ActionResult() { Results = results, Action = action, Date = DateTime.Now });
		}
	}

	public class ActionResult {

		public ActionResult() {
			Results = new List<string>();
		}

		public DateTime Date { get; set; }

		public string Action { get; set; }

		public IList<string> Results { get; set; }

		//todo: errors too
	}
}